[aliases]
n0=;
n1=;   first 2 aliases go along with "nuke nabber", an external nuke catcher utility
n2=;
n3=nuke {
n4=  if (%tvnuke [ $+ [ $1 ] ] ) || (%tvnuke [ $+ [ $2 ] ] ) halt
n5=  set %tvnuke [ $+ [ $1 ] ] $true | .timer 1 5 unset %tvnuke [ $+ [ $1 ] ]
n6=  set %tvnuke [ $+ [ $2 ] ] $true | .timer 1 5 unset %tvnuke [ $+ [ $2 ] ]
n7=  echo 4 -s Port scan detected!
n8=  if ($1 = 0) set %nukefound $scanchannel( [ *!*@ $+ [ $2 ] ] )
n9=  else {
n10=    set %nukefound $scanchannel( [ *!*@ $+ [ $1 ] ] )
n11=    if ((%nukefound = $false) && ($2 != $null)) set %nukefound $scanchannel( [ *!*@ $+ [ $2 ] ] )
n12=  }
n13=  if (%nukefound = $false) {
n14=    echo 4 -s Could not find this nuker on local channels
n15=    who *!*@ $+ $1
n16=  }
n17=  unset %nuke*
n18=}
n19=scanchannel {
n20=  echo 6 -s Scanning for address $1
n21=  %i = 0 | set %nukematch $false
n22=  :loopchans
n23=  inc %i
n24=  if $chan(%i) != $null {
n25=    set %nukenum 0
n26=    :nextnick
n27=    inc %nukenum
n28=    set %nukenick $ialchan($1,$chan(%i),%nukenum).nick
n29=    if %nukenick != $null {
n30=      set %nukematch $true
n31=      echo 4 -s Found match: %nukenick on $chan(%i)
n32=      if (($me isop $chan(%i)) && ($notop(%nukenick,$chan(%i)))) {
n33=        mode $chan(%i) -o+b %nukenick $address(%nukenick,4)
n34=        .timer 1 600 mode $chan(%i) -b $address(%nukenick,4)
n35=        kick $chan(%i) %nukenick Stay off my ports!  (AutoNab from NukeNabber)
n36=      }
n37=      elseif ($me isop $chan(%i)) {
n38=        if (%usespecific) echo 4 -s %nukenick is in your $wordlist($gl(%nukenick)) list on $chan(%i) $+ !
n39=        else echo 4 -s %nukenick is in your $wordlist($gl(%nukenick)) list!
n40=      }
n41=      goto nextnick
n42=    }
n43=    goto loopchans
n44=  }
n45=  return %nukematch
n46=}
n47=;
n48=;  miscellaneous stuff
n49=;
n50=portwin if $window(@Port_Listing) = $null window -an @Port_Listing 10 10 300 400
n51=addport {
n52=  portwin
n53=  if $window(@Port_Listing).state = minimized aline -h @Port_Listing $1-
n54=  else aline @Port_Listing $1-
n55=}
n56=getports {
n57=  if ($1 = $null) { set %tvserver $server } | else { set %tvserver $1 }
n58=  .enable #getports
n59=  addport %dis10 $+ Ports for: %tvserver
n60=  if ($1 = $null) { stats l } | else { stats l $1 }
n61=  .timer 1 30 .disable #getports
n62=}
n63=apost {
n64=  if ($right($1,1) = s) return $1 $+ '
n65=  else return $1 $+ 's
n66=}
n67=findip {
n68=  if $ial(*!*@ $+ $1,1).nick = $null {
n69=    altech -a %dis10 $+ No match for $1 found, resolving...
n70=    set %mip $1 | .enable #match | .disable #regdns | .dns *!*@ $+ $1
n71=  }
n72=  else altech -a %dis10 $+ Matched $1 to nick: $ial(*!*@ $+ $1).nick
n73=}
n74=time say The time is $realtime $day $+ , $adate
n75=addignore {
n76=  if $a2($1) != $null dde control $ddename $+ ignore ignore $1 $a3($1) $a4($1)
n77=  else {
n78=    echo 3 -a $1 is not in the internal address list, looking up info...
n79=    set %addnick $1 | .enable #altignore | userhost $1   
n80=  }
n81=}
n82=altech echo $1-
n83=;
n84=;  #mocklamer stuff
n85=;
n86=onmock if $me !ison #mocklamer { altech -a %dis10 $+ You're not on #MockLamer! | dh }
n87=mock? onmock | msg #mocklamer |mocklamer request| $1-
n88=mock onmock | .enable #verifylamer2 | set %mockee $1 | userhost $1
n89=mockon join #mocklamer | set %mocklamer $true | altech -a %dis10 $+ LamerMocking enabled
n90=mockoff set %mocklamer $false | altech -a %dis10 $+ LamerMocking disabled
n91=;
n92=;  aliases for the timed message creator...  these are all either called by the
n93=;  timed message creator itself, or from the popups
n94=;
n95=stopmessage {
n96=  if ($1 = Global) altech -a %dis10 $+ Halted timed global message
n97=  else altech -a %dis10 $+ Halted timed message to $1-
n98=}
n99=remtimer {
n100=  %p = 0
n101=  :nx
n102=  inc %p
n103=  if %tmsg [ $+ [ %p ] ] = $1 {
n104=    .timer $+ $calc(269 + %p) off
n105=    %tmsg [ $+ [ %p ] ] = ""
n106=  }     
n107=  if %p < 10 goto nx
n108=}
n109=domsg {
n110=  if (($1 = /msg) || ($1 = /describe)) {
n111=    if (($left($2,1) = $chr(35)) && ($me !ison $2)) { altech -a %dis10 $+ Halting timed message to $2 (you're not there!) | remtimer $2 | dh }
n112=    if $1 = /describe describe $2 $3-
n113=    else msg $2 $3-
n114=  }
n115=  else $1-
n116=}
n117=createmessage {
n118=  ; timed message of $2- to %who (%temp is the prefix) using delay $1
n119=  %i = 0
n120=  :nx
n121=  inc %i
n122=  if %tmsg [ $+ [ %i ] ] = $null {
n123=    set %tmsg [ $+ [ %i ] ] %who
n124=    .timer $+ $calc(269 + %i) 0 $1 domsg %temp $2-
n125=  }
n126=  else {
n127=    if %i = 10 { altech -a %dis10 $+ Sorry, you already have 10 timed messages going :( | dh }
n128=    goto nx
n129=  }
n130=  domsg %temp $2-
n131=}
n132=timedmsg {
n133=  if $1 = msg {
n134=    if $2 = all { set %temp /amsg | set %who Global ( $+ $left($4-,10) $+ ) }
n135=    else set { %temp /msg $2 | set %who $2 }
n136=  }
n137=  else {
n138=    if $2 = all { set %temp /ame | set %who Global Message }
n139=    else { set %temp /describe $2 | set %who $2 }
n140=  }
n141=  createmessage $3 $4-
n142=}
n143=;
n144=;  telnet, used to connect to a bot
n145=;
n146=telnet {
n147=  if %port [ $+ [ $1 ] ] = $null { altech -a %dis10 $+ Could not find port entry for $1 $+ ! | dg }
n148=  raw -q PRIVMSG $me : $+ $chr(1) $+ dcc chat chat $longip($2) %port [ $+ [ $1 ] ] $+ $chr(1)
n149=  unset %port [ $+ [ $1 ] ]
n150=}
n151=addapp {
n152=  ; this one is called by an external program
n153=  %i = 0
n154=  :nx2
n155=  inc %i
n156=  if %app [ $+ [ %i ] ] = $1 { altech -a %dis10 $+ An app with the name $1 is already in the menu! | dh }
n157=  if %i < 24 goto nx2
n158=  %i = 0
n159=  :nx
n160=  inc %i
n161=  if %app [ $+ [ %i ] ] = $null { 
n162=    set %app [ $+ [ %i ] ] $1 | set %appexe [ $+ [ %i ] ] $2-
n163=    altech -a %dis10 $+ Added $1 to Run Applications popups
n164=    dh
n165=  }
n166=  if %i < 24 goto nx
n167=  altech -a %dis10 $+ Maximum number of additions (24) already obtained! | alert
n168=}
n169=;
n170=;         encryption handling 
n171=;         can't change much here either.... it's all done inside an external app
n172=;
n173=enc dde control $ddename crypt $1 $+ @ $+ $2 $+ @ $+ $3-
n174=lsay enc none say $strip($1-)
n175=lme enc none me $strip($1-)
n176=esay say $1- $+ 4 $+ $str(200,!)
n177=;
n178=;        various text routines
n179=;
n180=rsay say $rc($1-)
n181=rme me $rc($1-)
n182=rbsay say  $+ $rc($1-)
n183=rbme me  $+ $rc($1-)
n184=wt {
n185=  %wt = $replace($1-,a,�) | %wt = $replace(%wt,b,�) | %wt = $replace(%wt,c,�)
n186=  %wt = $replace(%wt,d,�) | %wt = $replace(%wt,e,�) | %wt = $replace(%wt,f,f)
n187=  %wt = $replace(%wt,g,g) | %wt = $replace(%wt,h,h) | %wt = $replace(%wt,i,�)
n188=  %wt = $replace(%wt,j,j) | %wt = $replace(%wt,k,K) | %wt = $replace(%wt,l,�)
n189=  %wt = $replace(%wt,m,m) | %wt = $replace(%wt,n,�) | %wt = $replace(%wt,o,�)
n190=  %wt = $replace(%wt,p,�) | %wt = $replace(%wt,q,q) | %wt = $replace(%wt,r,�)
n191=  %wt = $replace(%wt,s,�) | %wt = $replace(%wt,t,t) | %wt = $replace(%wt,u,�)
n192=  %wt = $replace(%wt,v,v) | %wt = $replace(%wt,w,W) | %wt = $replace(%wt,x,�)
n193=  return $replace(%wt,y,�)
n194=}
n195=wcsay wsay $rc($1-)
n196=wcme wme $rc($1-)
n197=wsay say $wt($1-)
n198=wme me $wt($1-)
n199=stripetext {
n200=  %text = $replace($3-,$chr(32),$chr(1))
n201=  set %temp $r(1,2)
n202=  if %temp = 1 { set %color1 $1 | set %color2 $2 }
n203=  else { set %color1 $2 | set %color2 $1 }
n204=  %temp = "" | %i = 0
n205=  :nx
n206=  inc %i
n207=  set %temp %temp $+  $+ %color1 $+ , $+ %color2 $+ $mid(%text,%i,1)
n208=  if %color1 = $1 { set %color1 $2 | set %color2 $1 }
n209=  else { set %color1 $1 | set %color2 $2 }
n210=  if %i < $len(%text) goto nx
n211=  return $replace(%temp,$chr(1),$chr(32))
n212=}
n213=rinsult return $readini $mircdirtxt\insult.txt first [ n $+ [ $r(0,39) ] ] $readini $mircdirtxt\insult.txt second [ n $+ [ $r(0,30) ] ] of $readini $mircdirtxt\insult.txt third [ n $+ [ $r(0,42) ] ] 
n214=rchannels {
n215=  %chans = "" | %i = 0
n216=  set %count $r(3,9)
n217=  :nx
n218=  inc %i
n219=  set %num $r(0,76)
n220=  if (%tvused [ $+ [ %num ] ] ) goto nx
n221=  set %tvused [ $+ [ %num ] ] $true
n222=  %chans = %chans $readini $mircdirmisc.ini Channels [ n $+ [ %num ] ]
n223=  if %i < %count goto nx
n224=  unset %tvused*
n225=  return %chans 
n226=}
n227=insult say $1 $+ , you are a $rinsult
n228=insult2 say $1 $+ , $readini $mircdirtxt\insult.txt first [ n $+ [ $r(40,193) ] ] 
n229=notcode {
n230=  if $1 isnum 0-15 return $false
n231=  return $true
n232=}
n233=repeat {
n234=  set %text $1- $+ $chr(1)
n235=  set %text $replace(%text,$chr(32),$chr(1))
n236=  set %text $str(%text,50)
n237=  say $replace(%text,$chr(1),$chr(32))
n238=}
n239=shadow {
n240=  ;      first 3 lines are a bit strange due to an error in mIRC handing "else" 
n241=  ;      with the "isnum" operator
n242=  unset %color
n243=  if ($1 isnum 0-15) { set %color $1 | set %text $2- }
n244=  if %color = $null { set %color 4 | set %text $1- }
n245=  say  $+ %color $+ , $+ %color $str(,$calc($len(%text) + 1))
n246=  say 0, $+ %color %text  1,1
n247=  say  $+ %color $+ , $+ %color $str(,$calc($len(%text) + 1)) $+ 1,1
n248=  say 0,0 1,1 $str(,$calc($len(%text) + 1))
n249=}
n250=ssay {
n251=  if ($notcode($1)) say $stripetext(4,1,$1-)
n252=  elseif ($notcode($2)) say $stripetext($1,1,$2-)
n253=  else say $stripetext($1,$2,$3-)
n254=}
n255=sme {
n256=  if ($notcode($1)) me $stripetext(4,1,$1-)
n257=  elseif ($notcode($2)) me $stripetext($1,1,$2-)
n258=  else me $stripetext($1,$2,$3-)
n259=}
n260=backwards {
n261=  %text = $replace($1-,$chr(32),$chr(1))
n262=  %temp = "" | set %i $len(%text)
n263=  :nx
n264=  %temp = %temp $+ $mid(%text,%i,1)
n265=  dec %i
n266=  if %i > 0 goto nx
n267=  return $replace(%temp,$chr(1),$chr(32))
n268=}
n269=bsay say $backwards($1-)
n270=bn {
n271=  if # = $null { altech -a %dis10 $+ The /bn commands works only from a channel window! | dh }
n272=  notice # $backwards($1-)
n273=}
n274=bme me $backwards($1-)
n275=rc {
n276=  %t = 0 | %cms = "" | %a = $replace($1-,$chr(32),$chr(1))
n277=  :nx
n278=  inc %t
n279=  set %cms %cms $+  $+ $r(1,15) $+ ,00 $+ $mid(%a,%t,1)
n280=  if %t < $len($1-) goto nx
n281=  return $replace(%cms,$chr(1),$chr(32)) $+ 1,0
n282=}
n283=ding splay $mircdirding.wav
n284=dh ding | halt
n285=alert if (%salert = ding) ding
n286=playascii play -t $+ $1 $mircdirtxt\ascii.txt 1500
n287=ro return $readini $mircdiroptions\options.ini $1 $2
n288=reply raw -q notice $1 : $+ $2- $+ 
n289=tignore {
n290=  ; temp ignore that doesn't echo
n291=  ; $1 is ignore type, $2 is time in seconds, $3 is mask to ignore
n292=  .ignore - $+ $1 $3 | .timer 1 $2 .ignore -r $3
n293=}
n294=;
n295=;       misc. aliases that can be used by the user (also used by the scripts)
n296=;
n297=massinvite .enable #invitenames | set %chan $2 | names $1
n298=swhois {
n299=  inc %donewhois
n300=  .enable #aww
n301=  if undernet isin $server whois $1
n302=  else whois $1 $1
n303=}
n304=autowhois {
n305=  if (%tvdw [ $+ [ $a2($1) ] ] != $true) {
n306=    set %tvdw [ $+ [ $a2($1) ] ] $true
n307=    .timer 1 30 unset %tvdw [ $+ [ $a2($1) ] ]
n308=    if undernet isin $server whois $1
n309=    else whois $1 $1
n310=  }
n311=}
n312=q query $1
n313=swho .disable #nw | .enable #allwho | set %fwho $1- | set %fwht 0 | who $1-
n314=vn ctcp $1 version
n315=u ctcp $1 userinfo
n316=t ctcp $1 time
n317=c ctcp $1 clientinfo
n318=send dcc send $1 $2
n319=chat dcc chat $1
n320=ping ctcp $1 ping
n321=joinchannel {
n322=  set %chan $$?="Enter channel"
n323=  if $left(%chan,1) != $chr(35) set %chan $chr(35) $+ %chan
n324=  join %chan
n325=}
n326=join {
n327=  if $1 = $null { joinchannel | halt }
n328=  join $1 $2 $3 $4 $5 $6 $7 $8 $9 $10
n329=  %i = 0
n330=  :nx
n331=  inc %i
n332=  set %chan [ $ $+ [ %i ] ]
n333=  if %chan != $null {
n334=    if $left(%chan,1) = $chr(35) set %ticks [ $+ [ %chan ] ] $ticks
n335=    goto nx
n336=  }
n337=}
n338=j join #$1 #$2 #$3 #$4 #$5 #$6 #$7 #$8 #$9 #$10
n339=topic {
n340=  if ((+t isin $chan($1).mode) && ($me !isop $1)) { altech -a %dis10 $+ Sorry, $1 is +t and you are not opped | altech -a %dis10 $+ You cannot change the topic :( | dh }
n341=  else topic $1 $2-
n342=}
n343=p part #
n344=w {
n345=  if $pos($active,Status Window) = 1 { 
n346=    if undernet isin $server whois $1
n347=    else whois $1 $1
n348=  }
n349=  else swhois $1
n350=}
n351=wm {
n352=  %i = 0
n353=  :nx
n354=  inc %i
n355=  set %nick [ $ $+ [ %i ] ]
n356=  if %nick != $null {
n357=    if $undernet isin $server whois %nick
n358=    else whois %nick %nick
n359=    goto nx
n360=  }
n361=}
n362=wall wallops $1-
n363=amsg {
n364=  %k = 0
n365=  :nx
n366=  inc %k
n367=  if $chan(%k) != $null { msg $chan(%k) $1- | goto nx }
n368=}
n369=pn notice $1 Private Notice: $2-
n370=invite {
n371=  if $1 != $null invite $1-
n372=  else {
n373=    if # = $null { altech -a %dis10 $+ Syntax: /invite <nick> <channel>, or /invite <nick> if typed from a channel window | dh }
n374=    elseif ($1 = $null) invite $$?="Enter nick to invite" #
n375=    else invite $1 #
n376=  }
n377=}
n378=n notice $1 $2-
n379=;        hmmmm.... wonder how many scripts the next few aliases will wind up in
n380=;        this is original by me!
n381=;        these /op, /deop, /kick, /v, etc. aliases will work on any number of
n382=;        nicks (i.e. /op nick1 nick2 nick3 nick4 nick5 nick6, and will not exceed
n383=;        the number of mode changes per line you set in the options program
n384=op {
n385=  amiopped #
n386=  %i = 0
n387=  %nicks = ""
n388=  :nx
n389=  inc %i
n390=  set %nick [ $ $+ [ %i ] ]
n391=  if (%nick = $null) { if $len(%nicks) > 0 mode # +oooo %nicks | halt }
n392=  set %nicks %nicks %nick
n393=  if %maxmodes // %i { mode # +oooo %nicks | %nicks = "" }
n394=  goto nx
n395=}
n396=deop {
n397=  amiopped #
n398=  %i = 0
n399=  %nicks = ""
n400=  :nx
n401=  inc %i
n402=  set %nick [ $ $+ [ %i ] ]
n403=  if (%nick = $null) { if $len(%nicks) > 0 mode # -oooo %nicks | halt }
n404=  set %nicks %nicks %nick
n405=  if %maxmodes // %i { mode # -oooo %nicks | %nicks = "" }
n406=  goto nx
n407=}
n408=v {
n409=  amiopped #
n410=  %i = 0
n411=  %nicks = ""
n412=  :nx
n413=  inc %i
n414=  set %nick [ $ $+ [ %i ] ]
n415=  if (%nick = $null) { if $len(%nicks) > 0 mode # +vvvv %nicks | halt }
n416=  set %nicks %nicks %nick
n417=  if %maxmodes // %i { mode # +vvvv %nicks | %nicks = "" }
n418=  goto nx
n419=}
n420=dv {
n421=  amiopped #
n422=  %i = 0
n423=  %nicks = ""
n424=  :nx
n425=  inc %i
n426=  set %nick [ $ $+ [ %i ] ]
n427=  if (%nick = $null) { if $len(%nicks) > 0 mode # -vvvv %nicks | halt }
n428=  set %nicks %nicks %nick
n429=  if %maxmodes // %i { mode # -vvvv %nicks | %nicks = "" }
n430=  goto nx
n431=}
n432=s {
n433=  if # = $null { altech -a %dis10 $+ /s to sound only works when the active window is a channel window! | dh }
n434=  if ($right($1,4) = .wav) { ctcp # SOUND $1 $2- | splay $1 }
n435=  else { ctcp # SOUND $1 $+ .wav $2- | splay $1 $+ .wav }
n436=}
n437=k {
n438=  amiopped #
n439=  altech # 3ok, done
n440=  %i = 0
n441=  :nx
n442=  inc %i
n443=  set %nick [ $ $+ [ %i ] ]
n444=  if %nick != $null { kick # %nick %kickmsg | goto nx }
n445=}
n446=kr {
n447=  amiopped #
n448=  if $2 = $null set %reason %kickmsg
n449=  else set %reason $2-
n450=  if $1 ison # { altech # 3ok, done | kick # $1 %reason }
n451=  else altech -a %dis10 $+ $1 is not on # $+ !
n452=}
n453=server {
n454=  if $1 = $null {
n455=    if $server = $null {
n456=      if ((%server = $null) || (%sport = $null)) dde control $ddename $+ connect showlist $null
n457=      else dde control $ddename $+ connect showlist %server $+ : $+ %sport
n458=    }
n459=    else dde control $ddename $+ connect showlist $server $+ : $+ $port
n460=  }
n461=  else { if $server != $null quit Changing Servers | server $1- }
n462=}
n463=;
n464=;        function key definitions
n465=;
n466=F2 {
n467=  if ($away) dde control $ddename $+ away showyourself back
n468=  else dde control $ddename $+ away showyourself away
n469=}
n470=F3 {
n471=  if # = $null { altech -a %dis10 $+ F3 to ban the last to leave only works when the active window is a channel window! | dh }
n472=  amiopped #
n473=  if %lastpart [ $+ [ # ] ] = $null { altech -a %dis10 $+ I don't know who last parted # $+ ! | dh }
n474=  altech -a 3ok, done | mode # +b %lastpart [ $+ [ # ] ]
n475=  rtb %lastpart [ $+ [ # ] ] #
n476=}
n477=F4 {
n478=  if # = $null { altech -a %dis10 $+ The F4 to /onotice only works when the active window is a channel window! | dh }
n479=  onotice $$?="Enter message"
n480=}
n481=F5 .timer925 off | .ignore -r *!*@* | altech -a %dis10 $+ Total ignore is OFF | alert
n482=F6 .ignore -tcpni *!*@* | altech -a %dis10 $+ Total Ignore is on.  Press F5 to turn it off. | .timer925 0 60 altech -s %dis10 $+ Total Ignore is on.  Press F5 to turn it off. | alert
n483=F7 {
n484=  ckserv
n485=  if %icmpnick = $null { altech -a %dis10 $+ There is no nick set for ICMP revenge! | dh }
n486=  icmp %icmpnick
n487=}
n488=F8 ckserv | deopall #
n489=F9 {
n490=  ckserv
n491=  if # = $null { altech -a %dis10 $+ F9 only works while you are on a channel! | alert }
n492=  kickban $a3($$1) # | rtb $a3($$1) #
n493=}
n494=F10 {
n495=  if (%urd) altech -a %dis10 $+ Unix terminal emulation is already enabled!
n496=  else { set %urd $true | z | altech -a %dis10 $+ Unix terminal emulation enabled }
n497=  alert
n498=}
n499=SF3 {
n500=  if (%vote) { unset %vote* | .timer993 off | altech -a %dis10 $+ Vote cancelled! }
n501=  else altech -a %dis10 $+ There is no vote in progress!
n502=  alert
n503=}
n504=SF4 {
n505=  if # = $null { altech -a %dis10 $+ Shift-F4 to send a channel message only works when the active windows is a channel window! | dh }
n506=  msg # $$?="Enter channel message"
n507=}
n508=SF9 {
n509=  if # = $null { altech -a %dis10 $+ Shift F9 to ping only works when the active window is a channel window! | dh }
n510=  ctcp # PING
n511=}
n512=SF1 {
n513=  if %tvmip = $null { altech -a %dis10 $+ There is no address set to look up! | dh }
n514=  altech -a %dis10 $+ Looking up %tvmip (there may not be any matches!)
n515=  who %tvmip
n516=  .timer 1 120 unset %tvmip
n517=}
n518=SF2 {
n519=  if %tvgetports = $null { altech -a %dis10 $+ There is no server set to look up ports on! | dh }
n520=  altech -a %dis10 $+ Attempting cross-server port list (this may give strange results!)
n521=  getports %tvgetports
n522=}
n523=SF5 {
n524=  ckserv
n525=  if %ivn = $null { altech -a %dis10 $+ There is no nick set for the invite kick! | dh }
n526=  if %iva = $null { altech -a %dis10 $+ I don't know the address for %ivn :( | dh }
n527=  kickbanall %iva %invitemsg
n528=}
n529=SF6 {
n530=  ckserv
n531=  if %inv = $null { altech -a %dis10 $+ There is no channel set to join! | dh }
n532=  join %inv
n533=}
n534=SF8 ckserv | mkick # all
n535=SF10 {
n536=  if (%urd) { set %urd $false | close -m $me | altech -a %dis10 $+ Unix terminal emulation disabled }
n537=  else altech -a %dis10 $+ Unix terminal emulation is not active!
n538=  alert
n539=}
n540=realtime {
n541=  set %hour $left($time,$calc($pos($time,:) - 1))
n542=  set %minute $mid($time,$calc($pos($time,:) + 1),2)
n543=  if %hour = 00 return 12: $+ %minute AM
n544=  if %hour = 12 return 12: $+ %minute PM
n545=  if %hour > 12 { dec %hour 12 | return %hour $+ : $+ %minute PM }
n546=  else return %hour $+ : $+ %minute AM
n547=}
n548=;
n549=;              away stuff
n550=;
n551=setawaywithnick {
n552=  set %tvawaynick $1 | set %awayreason $2-
n553=  set %tvsettingaway $true
n554=  nick $1
n555=}
n556=setaway {
n557=  ckserv
n558=  if %tvawaynick = $null set %tvawaynick $me
n559=  if $away = $false remini $mircdirmisc.ini away
n560=  .enable #Away | set %amsg $1-
n561=  if $1- = %autoawaymsg set %autoset $true
n562=  else set %autoset $false
n563=  set %temp is away:  $1- 6(rec: $+ $chr(32)
n564=  if (%awaylog) set %temp %temp ON
n565=  else set %temp %temp OFF
n566=  if (%pager) { set %temp %temp  pager: ON)  To summon me, type /CTCP %tvawaynick PAGE | .enable #page }
n567=  else set %temp %temp  pager: OFF)
n568=  if (%noawaycolor) {
n569=    set %temp $strip(%temp)
n570=    away Since $realtime $+ , $day $adate ( $+ $strip($1-) $+ )
n571=  }
n572=  else away Since $realtime $+ , $day $adate ( $+ $1- $+ )
n573=  .timer974 off
n574=  if $chan(0) != 0 ame %temp
n575=  set %since $ctime
n576=  if (%msgaway) { %msgawaydelay = %msgawaydelay * 60 | .timer974 0 %msgawaydelay sa }
n577=}
n578=setback {
n579=  ckserv | .timer974 off
n580=  if ($away) { away | altech -a 3Telling the server you are no longer away... }
n581=  else { altech -a %dis10 $+ You are not marked away! | dh }
n582=}
n583=aa if ($away = $false) setaway %autoawaymsg
n584=autoaway .timer75 1 900 aa
n585=;
n586=;        channel vote
n587=;        Most of these aliases are called by an external program
n588=;
n589=chanvote {
n590=  altech -a %dis10 $+ Beginning vote on $1 | altech -a 3Press Shift-F3 at any time to cancel it
n591=  if $me !ison $1 { altech -a %dis10 $+ You are not on $1 $+ ! | altech -a 3Procedure Abored! | dh }
n592=  %time = $2 / 60 | set %voteon $3- | set %vote $true | set %votechan $1
n593=  %voteyes = 0 | %voteno = 0
n594=  .timer993 1 $2 endvote
n595=  if (%votecolor) {
n596=    msg $1 0,0����
n597=    describe $1 voting booths are now open
n598=    .timer 1 1 msg $1 0,0����
n599=    .timer 1 2 msg $1 2,0���The Question:12,0 $3-
n600=    .timer 1 3 msg $1 0,0����
n601=    if %time = 1 .timer 1 4 msg $1 4,0���Votes will be taken for 1 minute
n602=    else .timer 1 4 msg $1 4,0���Votes will be taken for %time minutes
n603=    if %votetype = 0 .timer 1 5 msg $1 2,0���This vote is for anyone (ops and non-ops) 
n604=    elseif %votetype = 1 .timer 1 5 msg $1 2,0���This vote is for anyone who is currently opped
n605=    elseif %votetype = 2 .timer 1 5 msg $1 2,0���This vote is for anyone in my op list
n606=    elseif %votetype = 3 .timer 1 5 msg $1 2,0���This vote is for anyone opped or in my op list
n607=    .timer 1 6 msg $1 0,0����
n608=    .timer 1 7 msg $1 2,0���To place a vote, 12,0/CTCP $me YES or NO
n609=  }
n610=  else {
n611=    describe $1 voting booths are now open
n612=    .timer 1 1 msg $1 The Question: $3-
n613=    if %time = 1 .timer 1 2 msg $1 Votes will be taken for 1 minute
n614=    else .timer 1 2 msg $1 Votes will be taken for %time minutes
n615=    if %votetype = 0 .timer 1 3 msg $1 This vote is for anyone (ops and non-ops) 
n616=    elseif %votetype = 1 .timer 1 3 msg $1 This vote is for anyone who is currently opped
n617=    elseif %votetype = 2 .timer 1 3 msg $1 This vote is for anyone in my op list
n618=    elseif %votetype = 3 .timer 1 3 msg $1 This vote is for anyone opped or in my op list
n619=    .timer 1 4 msg $1 To place a vote, /CTCP $me YES or NO
n620=  }
n621=}
n622=endvote {
n623=  %votetotal = %voteyes + %voteno
n624=  if %votetotal = 0 {
n625=    %votepertotal = 0
n626=    %voteyesper = 0
n627=    %votenoper = 0
n628=  }
n629=  else {
n630=    if %voteyes = 0 set %voteyesper 0
n631=    else %voteyesper = $calc((%voteyes / %votetotal) * 100)
n632=    if %voteno = 0 set %votenoper 0
n633=    else %votenoper = $calc((%voteno / %votetotal) * 100)
n634=    %votepertotal = $calc((%votepossible / %votetotal) * 100)
n635=  }
n636=  if %votetype = 0 set %votepossible $nick(%votechan,0) 
n637=  elseif %votetype = 1 set %votepossible $opnick(%votechan,0)
n638=  elseif %votetype = 2 set %votepossible $knownops(%votechan,0)
n639=  elseif %votetype = 3 set %votepossible $knownops(%votechan,1)
n640=  if %votepossible = 0 set %votepertotal 0
n641=  describe %votechan voting booths are now closed
n642=  if (%votecolor) {
n643=    .timer 1 1 msg %votechan 0,0����
n644=    .timer 1 2 msg %votechan 2,0���The Question was:12,0 %voteon
n645=    .timer 1 3 msg %votechan 0,0����
n646=    .timer 1 4 msg %votechan 2,0���Possible Votes:12,0 %votepossible
n647=    .timer 1 5 msg %votechan 2,0�� Votes Received:12,0 %votetotal ( $+ %votepertotal $+ [ % ] $+ )
n648=    .timer 1 6 msg %votechan 0,0����
n649=    .timer 1 7 msg %votechan 2,0���Results:12,0 %voteyes ( $+ %voteyesper $+ [ % ] $+ ) said Yes, %voteno ( $+ %votenoper $+ [ % ] $+ ) said No
n650=  }
n651=  else {
n652=    .timer 1 1 msg %votechan The Question was: %voteon
n653=    .timer 1 2 msg %votechan Possible Votes: %votepossible
n654=    .timer 1 3 msg %votechan Votes Received: %votetotal ( $+ %votepertotal $+ [ % ] $+ )
n655=    .timer 1 4 msg %votechan Results: %voteyes ( $+ %voteyesper $+ [ % ] $+ ) said Yes, %voteno ( $+ %votenoper $+ [ % ] $+ ) said No
n656=  }
n657=  unset %vote*
n658=}
n659=;
n660=;        misc. aliases (mostly just support for other routines)
n661=;
n662=alwaysjoin {
n663=  %c = 0
n664=  :nx
n665=  inc %c
n666=  if %alwaysjoin [ $+ [ %c ] ] != $null {
n667=    if $me !ison %alwaysjoin [ $+ [ %c ] ] join %alwaysjoin [ $+ [ %c ] ]
n668=    goto nx
n669=  }
n670=}
n671=multictcp {
n672=  %i = 0
n673=  :nx
n674=  inc %i | if $snick($1,%i) != $null { ctcp $snick($1,%i) *2 | goto nx }
n675=}
n676=color dde color $ddename $+ color showthouself please
n677=botlog if (%botlog) write $logdirbotlite.log $realtime $+ , $day $adate $1-
n678=rp set %dur $replace(%dur,$1,$2-)
n679=dur {
n680=  set %dur $duration($calc($ctime - $1))
n681=  rp hrs hours | rp 1hr 1 hour | rp secs seconds |  rp 1sec 1 second | rp mins minutes
n682=  rp 1min 1 minute | rp wks weeks | rp 1wk 1 week | rp days days | rp 1day 1 day
n683=  return $replace(%dur,,$chr(32))
n684=}
n685=dur2 {
n686=  set %dur $duration($1)
n687=  rp hrs hours | rp 1hr 1 hour | rp secs seconds |  rp 1sec 1 second | rp mins minutes
n688=  rp 1min 1 minute | rp wks weeks | rp 1wk 1 week | rp days days | rp 1day 1 day
n689=  return $replace(%dur,,$chr(32))
n690=}
n691=onotice onotice [Ops on # $+ ] $1-
n692=cm {
n693=  if # = $null { altech -a %dis10 $+ /cm to send a channel message only works while you are on a channel! | dh }
n694=  else msg # $1-
n695=}
n696=amiopped if ($me !isop $1) { altech -a %dis10 $+ You are not opped on $1 $+ ! | dh }
n697=ckserv if $server = $null { altech -a %dis10 $+ You are not connected to a server! | dh }
n698=allnicks {
n699=  %nicks = "" | %i = 0
n700=  :nx
n701=  inc %i
n702=  if $snick($1,%i) != $null { %nicks = %nicks $snick($1,%i) | goto nx }
n703=  return %nicks
n704=}
n705=ak {
n706=  amiopped $1
n707=  set %chan $1 | set %tn $2 | $readini $mircdirmisc.ini kicks $3
n708=}
n709=sa ame is AWAY: %amsg (away $dur(%since) $+ )
n710=ic if ($chat($1) = $null) { altech -a %dis10 $+ I don't think $1 is an eggdrop! | dh }
n711=isnum {
n712=  %k = 0
n713=  :nx
n714=  inc %k
n715=  if $mid($1,%k,1) isnum 0-9 goto skip
n716=  return $false
n717=  :skip
n718=  if %k < $len($1) goto nx  
n719=  return $true
n720=}
n721=ptb mode $3 -o+b $1 $2 | rtb $2 $3
n722=rtb .timer 1 %bantime if ($me isop $2) mode $2 -b $1
n723=tgn {
n724=  if $me = %mynick .timer930 off
n725=  else nick %mynick
n726=}
n727=cnick set %dontcare $true | .timer931 1 10 unset %dontcare | nick $1
n728=getnick nick %mynick | .timer930 0 30 tgn
n729=chpd if ((%nspd = NickPass) || (%nspd = $null)) { altech -a %dis10 $+ You have not set a NickServ password! | dh }
n730=chcpd if ((%cspd = ChanPass) || (%cspd = $null)) { altech -a %dis10 $+ You have not set a ChanServ password! | dh }
n731=sk kick # $1 %kickmsg
n732=skb kick # $1 %kickbanmsg
n733=tk .timer 1 3 kick $2 $1 $3-
n734=kickban {
n735=  set %prefix - | %i = 0 | %change = "" | %nummode = 0 | %nicks = ""
n736=  :nx
n737=  inc %i
n738=  set %nick $ialchan($1,$2,%i).nick
n739=  if $ialchan($1,$2,%i).nick != $null {
n740=    set %prefix %prefix $+ o | %change = %change %nick
n741=    inc %nummode | set %nicks %nicks $+ %nick $+ $chr(1)
n742=    if (%maxmodes // %nummode) {
n743=      mode $2 %prefix %change
n744=      set %prefix - | %change = ""
n745=    }
n746=    goto nx
n747=  }
n748=  %prefix = %prefix $+ +b | %change = %change $1
n749=  mode $2 %prefix %change
n750=  if $3 = $null set %reason %kickbanmsg
n751=  else set %reason $3-
n752=  %i = 0
n753=  :kick
n754=  set %pos $calc($pos(%nicks,$chr(1)) - 1)
n755=  set %thisnick $left(%nicks,%pos)
n756=  set %nicks $right(%nicks,$calc($len(%nicks) - %pos - 1))
n757=  if %thisnick != $null {
n758=    kick $2 %thisnick %reason
n759=    goto kick
n760=  }
n761=}
n762=adeop {
n763=  ; deop all people that match address $1 from channel $2
n764=  %n = 0
n765=  :nx
n766=  inc %n
n767=  if $ialchan($1,$2,%n) != $null {
n768=    mode $2 -o $ialchan($1,$2,%n).nick
n769=    goto nx
n770=  }
n771=}
n772=kickall {
n773=  ; kick everyone who matches address $1 from channel $2 using reason $3
n774=  %n = 0
n775=  :nx
n776=  inc %n
n777=  if $ialchan($1,$2,%n) != $null {
n778=    kick $2 $ialchan($1,$2,%n).nick $3-
n779=    goto nx
n780=  }
n781=}
n782=kickbanall {
n783=  ; kick-ban everyone who matches address $1 from channel $2 using reason $3
n784=  %n = 0
n785=  :nx
n786=  inc %n
n787=  if $ialchan($1,$2,%n) != $null {
n788=    if (%tvdidban [ $+ [ $1 ] ] != $true) { mode $2 +b $1 | rtb $1 $2 | set %tvdidban [ $+ [ $1 ] ] $true }
n789=    kick $2 $ialchan($1,$2,%n).nick $3-
n790=    goto nx
n791=  }
n792=  unset %tvdidban*
n793=}
n794=gkick {
n795=  ; given a nick, kick anyone who matches the address from all channels I'm opped on using reason $2-
n796=  %n = 0
n797=  :nx
n798=  inc %n
n799=  if $2 = $null set %reason %kickmsg
n800=  else set %reason $2-
n801=  if ($chan(%n) != $null) {
n802=    if ($me isop $chan(%n)) kickall $a3($1) $chan(%n) %reason
n803=    goto nx
n804=  }
n805=}
n806=gkb {
n807=  ; given a nick, kick-ban anyone who matches the address from all channels I'm opped on using reason $2-
n808=  %n = 0
n809=  :nx
n810=  inc %n
n811=  if $2 = $null set %reason %kickmsg
n812=  else set %reason $2-
n813=  if ($chan(%n) != $null) {
n814=    if ($me isop $chan(%n)) kickbanall $a3($1) $chan(%n) %reason
n815=    goto nx
n816=  }
n817=}
n818=kball {
n819=  ; kick-ban everyone that matches address $1 from all channels I'm opped on using reason $2-
n820=  %n = 0
n821=  :nx
n822=  inc %n
n823=  if ($chan(%n) != $null) {
n824=    if ($me isop $chan(%n)) kickbanall $1 $chan(%n) $2-
n825=    goto nx
n826=  } 
n827=}
n828=tb .timer 1 2 mode # -o+b $1 $a3($1) | rtb $a3($1) #
n829=am return $asc($mid($2-,$1,1))
n830=ckmd if (($nick($1,0) = 1) && (%enforcemodes)) emode $1
n831=log if (%log) write $logdirsession.log $realtime $+ , $day $adate $1-
n832=quit {
n833=  if $1 = $null quit %quitmsg
n834=  else quit $1-
n835=}
n836=getlag reply $me LAGCHECK $ctime
n837=kick {
n838=  amiopped $1
n839=  kick $1-
n840=}
n841=mode {
n842=  if (%urd) raw mode $1-
n843=  else mode $1-
n844=}
n845=modeall {
n846=  %i = 0
n847=  :nx
n848=  inc %i
n849=  if $chan(%i) != $null {
n850=    if $me isop $chan(%i) mode $chan(%i) $1-
n851=    goto nx
n852=  }
n853=}
n854=msg {
n855=  if (%urd) raw PRIVMSG $1 : $+ $2-
n856=  else msg $1 $2-
n857=}
n858=notice {
n859=  if (%urd) raw NOTICE $1 : $+ $2-
n860=  else notice $1 $2-
n861=}
n862=topicok if ((+t isin $chan($1).mode) && ($me !isop $1)) { altech -a %dis10 $+ Sorry, $1 is +t and you are not opped | altech -a %dis10 $+ You cannot change the topic :( | dh }
n863=z q $me
